using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;


namespace Open.Product.Domain.Dto
{
    /// <summary>
    /// 商品模型
    /// </summary>

    public class BaseProductDto 
    {
        /// <summary>
        /// 主键
        /// </summary>
        public long Id { get; set; }
        /// <summary>
        /// 门店编号
        /// </summary>
        public long StoreId { get; set; }
        /// <summary>
        /// 排序号
        /// </summary>
        public long Sort { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 商品分类主键
        /// </summary>
        public long ProductCategoryId { get; set; }
        /// <summary>
        /// 商品分类名称
        /// </summary>
        public string ProductCategoryIdName { get; set; }
        /// <summary>
        /// 品牌主键
        /// </summary>
        public long BrandId { get; set; }
        /// <summary>
        /// 商品品牌名称
        /// </summary>
        public string BrandName { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        [Required]
        [StringLength(128)]
        [RegularExpression("^[a-zA-z0-9]+$", ErrorMessage = "编码只能是数字或英文")]
        public string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [Required]
        [StringLength(512)]
        public string Name { get; set; }

        /// <summary>
        /// 拼音码
        /// </summary>
        [StringLength(512)]
        public string PyCode { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        //[Required]
        [StringLength(128)]
        public string Spec { get; set; }
        /// <summary>
        /// 商品图片地址
        /// </summary>
        public string ImgUrl { get; set; }

        /// <summary>
        /// 计价方式
        /// </summary>
        public int PricingMode { get; set; }
        /// <summary>
        /// 型号
        /// </summary>
        public string Model { get; set; }

        /// <summary>
        /// 全程通商品Id
        /// </summary>
        public int QCTProductId { get; set; }

        /// <summary>
        /// 全程通单品Id
        /// </summary>
        public int SkuId { get; set; }

        /// <summary>
        /// 招财猫中台Id
        /// </summary>
        public long QId { get; set; }

        /// <summary>
        /// 计价方式名称
        /// </summary>
        [StringLength(128)]
        public string PricingModeName { get; set; }
        /// <summary>
        /// 商品属性 0-普通商品，1-捆绑商品 2-分级商品
        /// </summary>
        public int ProductAttribute { get; set; }
        /// <summary>
        /// 商品属性名称
        /// </summary>
        public string ProductAttributeName { get; set; }
        /// <summary>
        /// 产地
        /// </summary>
        [StringLength(256)]
        public string ProducingArea { get; set; }
        /// <summary>
        /// 保质期
        /// </summary>
        public int ShelfLife { get; set; }

        /// <summary>
        /// 商品规格集合
        /// </summary>
        public List<ProductStandardInput> BaseProductStandardList { get; set; }

        /// <summary>
        /// 条码
        /// </summary>
        public string BarCode { get; set; }
        /// <summary>
        /// 是否参与会员折扣
        /// </summary>
        public bool IsJoinMemberDiscount { get; set; }
        /// <summary>
        /// 是否参与促销
        /// </summary>
        public bool IsJoinProject { get; set; }
        /// <summary>
        /// 是否允许折扣
        /// </summary>
        public bool IsAllowDiscount { get; set; }
        /// <summary>
        /// 是否允许赠送
        /// </summary>
        public bool IsAllowGive { get; set; }
        /// <summary>
        /// 是否允许议价
        /// </summary>
        public bool IsAllowBargain { get; set; }
        /// <summary>
        /// 是否允许标签打印
        /// </summary>
        public bool IsAllowLabelPrint { get; set; }
        /// <summary>
        /// 是否隐藏
        /// </summary>
        public bool IsHide { get; set; }
        /// <summary>
        /// 是否积分
        /// </summary>
        public bool IsPoint { get; set; }
        /// <summary>
        /// 是否双倍积分
        /// </summary>
        public bool IsDoublePoint { get; set; }
        /// <summary>
        /// 是否待审核商品
        /// </summary>
        public bool IsExamineAndVerify { get; set; }
        /// <summary>
        /// 是否门店独立定价
        /// </summary>
        public bool IsSetStorePrice { get; set; } = false;
        #region v1.9_lzh
        /// <summary>
        /// 默认供应商ID
        /// </summary>
        public long? SupplierId { get; set; }
        /// <summary>
        /// 默认供应商名称
        /// </summary>
        public string SupplierName { get; set; }
        #endregion
        /// <summary>
        /// 商品备注
        /// </summary>
        public string Remark { get; set; }

    }

    public class BaseProductResultDto
    {
        public string Id { get; set; }
        /// <summary>
        /// 分类Id
        /// </summary>
        public string ProductCategoryId { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 商品编码
        /// </summary>
        public string Code { get; set; }
    }
    /// <summary>
    /// 商品查询模型
    /// </summary>
    public class BaseProductGetAllInput /*: PagedResultRequestDto, ISortedResultRequest*/
    {
        /// <summary>
        /// 查询关键字（编码、名称、拼音码）
        /// </summary>
        public string Keyword { get; set; }
        /// <summary>
        /// 排序字段
        /// </summary>
        public string Sorting { get; set; } = "Sort";
        /// <summary>
        /// 商品类型主键
        /// </summary>
        public long ProductCategoryId { get; set; }
        /// <summary>
        /// 商品主键
        /// </summary>
        public long ProductId { get; set; } = 0;
        /// <summary>
        /// 商品状态 -1-全部，0-禁用 1-启用
        /// </summary>
        public int Status { get; set; } = -1;
        /// <summary>
        /// 品牌ID
        /// </summary>
        public long? BrandId { get; set; }
        /// <summary>
        /// 计价方式
        /// </summary>
        public int? PricingMode { get; set; }
        /// <summary>
        /// 商品属性1--全部商品  3 --- 服務商品
        /// </summary>
        public int? ProductAttribute { get; set; }
        /// <summary>
        /// 商品属性
        /// </summary>
        //public List<int> ProductAttributeList { get; set; }
    }

    public class BaseProductGetSortInput /*: PagedResultRequestDto, ISortedResultRequest*/
    {
        public string Sorting { get; set; } = "Sort";
        /// <summary>
        /// 商品类型主键
        /// </summary>
        public string ProductCategoryId { get; set; }
    }
}
